<?php

class Admin_Form_Abbreviation extends Zend_Form
{
    public function __construct($options=null)
    {
        parent::__construct($options);
        
        $configForms = dirname(__FILE__) . '/forms.xml';        
        $config = new Zend_Config_Xml($configForms, 'abbreviation');
        $this->setConfig($config);
        
        // Submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')
               ->setAttrib('dojoType', 'dijit.form.Button');        
        $this->addElement($submit);                
    }
    
    public function bindPostData($formData)
    {
        $elements = $this->getElements();
        $keys = array_keys($elements);
        $keys = array_diff($keys, array('submit'));
        
        $data = array();
        
        foreach($formData as $key => $value) {
            if(in_array($key, $keys)) {
                $data[$key] = $value;
            }
        }
        
        return $data;
    }
}